<%@ page language="java" import="java.util.*, com.zjut.an.util.tools.*,com.zjut.an.util.system.*,
com.zjut.zs.user.manager.*, com.zjut.zs.user.dao.*,com.zjut.an.news.manager.*,com.zjut.an.news.dao.*,com.zjut.zs.userstatus.manager.*, com.zjut.zs.userstatus.dao.*,
com.zjut.zs.school.manager.*, com.zjut.zs.school.dao.*, com.zjut.an.config.manager.*" pageEncoding="utf-8"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>状态查询 - 三位一体综合评价招生报名系统</title>
    <script src="css/tailwindcss.css"></script>
    <script src="js/anime.min.js"></script>
    <link href="css/css2.css" rel="stylesheet">
    <link href="css/icon.css" rel="stylesheet">
    <style>
        body {
            font-family: 'Noto Sans SC', sans-serif;
        }
        @keyframes pulse {
            0%, 100% { transform: scale(1); }
            50% { transform: scale(1.1); }
        }
        .status-card {
            background: white;
            border-radius: 12px;
            padding: 24px;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
            margin-bottom: 24px;
        }
        .status-header {
            display: flex;
            justify-content: between;
            align-items: center;
            margin-bottom: 16px;
        }
        .status-title {
            font-size: 20px;
            font-weight: 600;
            color: #1f2937;
        }
        .status-badge {
            padding: 6px 12px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 500;
        }
        .status-badge.success {
            background: #dcfce7;
            color: #166534;
        }
        .status-badge.warning {
            background: #fef3c7;
            color: #92400e;
        }
        .status-badge.info {
            background: #dbeafe;
            color: #1e40af;
        }
        .status-badge.error {
            background: #fee2e2;
            color: #dc2626;
        }
        .timeline-icon {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-right: 16px;
            font-size: 14px;
        }
        .timeline-icon.success {
            background: #dcfce7;
            color: #166534;
        }
        .timeline-icon.warning {
            background: #fef3c7;
            color: #92400e;
        }
        .timeline-icon.info {
            background: #dbeafe;
            color: #1e40af;
        }
        .timeline-title {
            font-weight: 500;
            color: #374151;
            margin-bottom: 2px;
        }
    </style>
</head>
<body class="bg-gray-50 min-h-screen">
<jsp:include page="zs_uservalidate.jsp" flush="true"/>
<%
    if (session.getAttribute("zsUser") == null&&session.getAttribute("admin") == null&&session.getAttribute("user") == null) {
        out.print("<script>alert('由于长时间未操作，系统已经自动注销，请重新登陆');</script>");
        out.print("<script>top.window.location='main.jsp';</script>");
    } else {
        AnConfigManager anconfig = (AnConfigManager) SpringContextUtil.getBean("AnConfigManager");
        ZsSchoolManager zsManager = (ZsSchoolManager) SpringContextUtil.getBean("ZsSchoolManager");
        ZsUserManager umanager = (ZsUserManager) SpringContextUtil.getBean("ZsUserManager");
        ZsUserStatusManager smanager = (ZsUserStatusManager) SpringContextUtil.getBean("ZsUserStatusManager");
        ZsSchool school = new ZsSchool();
        school = (ZsSchool)zsManager.getDataByInstance(1,1,null,null,school).getObjects().get(0);

        ZsUser user = null;
        if(session.getAttribute("admin")!=null && request.getParameter("usId")!=null) {
            String usId = request.getParameter("usId");
            user = umanager.getData(usId);
        } else if (session.getAttribute("zsUser")!=null) {
            user = (ZsUser)session.getAttribute("zsUser");
        }
        ZsUserStatus userStatus = smanager.getDataByUser(user);
%>
    <div class="max-w-6xl mx-auto px-4 py-8">
        <!-- 当前状态概览 -->
        <div class="status-card">
            <div class="status-header">
                <h2 class="status-title">报名信息概览</h2>
            </div>
            
            <div class="grid md:grid-cols-3 gap-6 mb-6">
                <div class="text-center">
                    <div class="text-2xl font-bold text-blue-600 mb-1"><%=user.getUsNo() %></div>
                    <div class="text-sm text-gray-600">网上报名编号</div>
                </div>
                <div class="text-center">
                    <div class="text-2xl font-bold text-green-600 mb-1"><%=user.getUsName() %></div>
                    <div class="text-sm text-gray-600">考生姓名</div>
                </div>
                <div class="text-center">
                    <div class="text-2xl font-bold text-purple-600 mb-1"><%=userStatus.getScColumn1() %></div>
                    <div class="text-sm text-gray-600">报考类型</div>
                </div>
            </div>
        </div>

        <!-- 报名流程进度 -->
        <div class="status-card">
            <h2 class="status-title mb-6">报名流程</h2>
            <%
                AnNewsManager nmanager = (AnNewsManager) SpringContextUtil.getBean("AnNewsManager");
                AnNews news = new AnNews();
                news.setTitle("报考流程单页面");
                List list = nmanager.getDataByInstance(1,1,null,null,news).getObjects();
                if(list.size()>0) {
                    news = (AnNews)list.get(0);
                    out.print(news.getNeContent());
                }
            %>
        </div>

        <!-- 详细信息 -->
        <div class="grid md:grid-cols-2 gap-6">
            <!-- 审核状态 -->
            <div class="status-card">
                <h2 class="status-title mb-4">报考状态</h2>
                <div class="space-y-3">
                    <%
                        boolean checkPub = false;
                        if (Status.ON.getStatus().equals(school.getScCheckpubActive())&&!Status.CHECKSTATUS_NULL.getStatus().equals(userStatus.getCheckStatus()))checkPub=true;%>
                    <div class="flex justify-between items-center p-4 bg-blue-50 rounded-lg">
                        <div>
                            <div class="font-medium text-gray-900">学校初审</div>
                            <div class="text-sm text-gray-600">
                                <%if(checkPub) {
                                if(Status.CHECKSTATUS_NO.getStatus().equals(userStatus.getCheckStatus())) {
                                    out.print(anconfig.getSingleConfigInfoByName("初审不过显示") );
                                    if(userStatus.getCheckRemark().trim().length()>0) {
                                        out.print(userStatus.getCheckRemark());
                                    }
                                } else {
                                    out.print(anconfig.getSingleConfigInfoByName("初审通过显示") );
                                }
                            }else{
                                out.print("尚未发布");
                            }%></div>
                        </div>
                    </div>
                    <%
                        boolean passPub = false;
                        if (Status.ON.getStatus().equals(school.getScPasspubActive())&&!Status.PASSSTATUS_NULL.getStatus().equals(userStatus.getPassStatus()))passPub=true;%>
                    <div class="flex justify-between items-center p-4 bg-blue-50 rounded-lg">
                        <div>
                            <div class="font-medium text-gray-900">综合评审结果</div>
                            <div class="text-sm text-gray-600">
                                <%if(passPub) {
                                    if(Status.CHECKSTATUS_NO.getStatus().equals(userStatus.getCheckStatus())) {
                                        out.print(anconfig.getSingleConfigInfoByName("综合测试未通过显示") );
                                        if(userStatus.getCheckRemark().trim().length()>0) {
                                            out.print(userStatus.getCheckRemark());
                                        }
                                    } else {
                                        out.print(anconfig.getSingleConfigInfoByName("综合测试通过显示") );
                                    }
                                }else{
                                    out.print("尚未发布");
                                }%></div>
                        </div>
                    </div>
                    <%
                        boolean testPub = false;
                        if (Status.ON.getStatus().equals(school.getScTestpubActive()))testPub=true;%>
                    <div class="flex justify-between items-center p-4 bg-blue-50 rounded-lg">
                        <div>
                            <div class="font-medium text-gray-900">综合评审成绩</div>
                            <div class="text-sm text-gray-600">
                                <%if(testPub) {
                                    out.print(userStatus.getTestNum());
                                }else{
                                    out.print("尚未发布");
                                }%></div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 重要通知 -->
            <div class="status-card">
                <h2 class="status-title mb-4">重要通知</h2>
                <div class="space-y-3">
                    <div class="p-3 bg-yellow-50 rounded-lg">
                        <div class="flex items-start">
                            <div class="timeline-icon warning mr-3">!</div>
                            <div>
                                <div class="timeline-title"><%if (userStatus.getMessage()!=null&&userStatus.getMessage().trim().length()>0)out.print(userStatus.getMessage().replace("null","")); %></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- 操作按钮 -->
        <div class="flex justify-between mt-8">
            <div class="space-x-4">
                <button onclick="refreshStatus()"
                        class="bg-blue-600 text-white px-8 py-3 rounded-lg hover:bg-blue-700 transition-colors duration-300">
                    刷新状态
                </button>
            </div>
        </div>
    </div>

    <script>
        // 刷新状态
        function refreshStatus() {
            location.reload();
        }
    </script>
<%}%>
</body>
</html>